# -*- encoding=utf8 -*-
__author__ = "Admin"

from airtest.core.api import *
from airtest.cli.parser import cli_setup

if not cli_setup():
    auto_setup(__file__, logdir=True, devices=["android://127.0.0.1:5037/emulator-5554?",])
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

from airtest.report.report import simple_report
import os



# script content
print("start...")


poco("库客音乐").click()
poco("com.kkpodcast:id/input_phone_et").click()
poco("com.kkpodcast:id/input_phone_et").set_text("17550010261")
poco("com.kkpodcast:id/input_password_et").click()
poco("com.kkpodcast:id/input_password_et").set_text("a12345678")
poco("com.kkpodcast:id/checkbox").click()
poco("com.kkpodcast:id/login_tv").click()
poco("com.kkpodcast:id/mine_rb").click()
poco("com.kkpodcast:id/right_icon_iv").click()
poco("com.kkpodcast:id/login_out_tv").click()
home()

from airtest.report.report import simple_report
# 设置自定义报告目录
custom_log_dir = r"E:\Work\codings\python\2506project\airtest\reports"

# 确保目录存在
if not os.path.exists(custom_log_dir):
    os.makedirs(custom_log_dir)
# generate html reports
simple_report(__file__, logpath=True, output=os.path.join(custom_log_dir, "login.html"))


